package com.sky.config;

import com.sky.properties.COSProperties;
import com.sky.utils.QcloudUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class COSClientConfig {
    @Bean
    @ConditionalOnMissingBean
    public QcloudUtil qcloudUtil(COSProperties cosProperties) {
        log.info("初始化文件上传云存储QcloudUtil");
        return new QcloudUtil(
                cosProperties.getSecretId(),
                cosProperties.getSecretKey(),
                cosProperties.getBucketName(),
                cosProperties.getRegionName(),
                cosProperties.getBucketUrl());
    }
}

